using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using EVELogApi;

namespace EVEChatLib
{
    public partial class Lib
    {
        public void generateChannelsTree(TreeView tree, string logPath)
        {
            // Start off by initilising the class
            API treeAPI = new API(logPath);

            tree.Nodes.Clear();


            TreeNode node = tree.Nodes.Add("Global Channels");
            node.Tag = "";

            TreeNode localNode = node.Nodes.Add("Local");
            localNode.Tag = "Local";

            TreeNode corpNode = node.Nodes.Add("Corp");
            corpNode.Tag = "Corp";

            TreeNode allianceNode = node.Nodes.Add("Alliance");
            allianceNode.Tag = "Alliance";

            TreeNode fleetNode = node.Nodes.Add("Fleet");
            fleetNode.Tag = "Fleet";

            TreeNode EVEHQPUBLICNode = node.Nodes.Add("EVEHQ PUBLIC");
            EVEHQPUBLICNode.Tag = "EVEHQ_PUBLIC";

            node = tree.Nodes.Add("Private Chats");
            node.Tag = "";

            string[] privLists = treeAPI.getPrivateChatList();
            foreach (string name in privLists)
            {
                TreeNode tempNode = node.Nodes.Add(name.Replace("_", " "));
                tempNode.Tag = name;
            }

            node = tree.Nodes.Add("Group Chats");
            node.Tag = "";

            string[] groupLists = treeAPI.getGroupChatList();
            foreach (string name in groupLists)
            {
                TreeNode tempNode = node.Nodes.Add(name.Replace("_", " "));
                tempNode.Tag = name;
            }

            node = tree.Nodes.Add("Other Channels");
            node.Tag = "";

            string[] otherChannels = treeAPI.getOtherChannelsList();
            foreach (string name in otherChannels)
            {
                TreeNode tempNode = node.Nodes.Add(name.Replace("_", " "));
                tempNode.Tag = name;
            }

            tree.ExpandAll();
        }
    }
}
